home *** CD-ROM | disk | FTP | other *** search
- Path: sunb.ocs.mq.edu.au!pixel!eddyg
- From: marting@jtec.com.au (Martin Gregory)
- Newsgroups: comp.lang.c++,comp.object
- Subject: Style question: OOD & initialisation
- Date: 13 Mar 1996 07:47:18 GMT
- Organization: JTEC Pty Ltd Perth R&D Office
- Distribution: world
- Message-ID: <MARTING.96Mar13154718@igly.jtec.com.au>
- NNTP-Posting-Host: valhalla.mpce.mq.edu.au
-
-
- Suppose you have designed your system wonderfully in an OOD sort of
- sense. It seems to me that this means you may well have ended up with
- some sort of 'agent' class which controls everything, and knows how to
- despatch activities. The question in my mind is how should you
- instantiate this controller. To me, this (at first) seemed elegant:
-
-
- class Controller
- {
- public:
- Controller();
- //...
- }
-
- Controller::Controller()
- {
-
- Thingy Servant1, Servant2;
-
- // ... instantiate all the other things in the system, then...
-
- while (still_something_to_be_done)
- {
- // hand out stuff
- }
- }
-
- main()
- {
- Controller TheController;
- }
-
-
- However, is this concept of a constructor that doesn't exit till the
- end of time a bit of a worry? (I think it is at least valid.)
-
- Would this type of thing be preferrable:
-
- main()
- {
- Controller TheController;
-
- TheController.Go();
- }
-
- If so, why?
-
- Cheers,
-
- Martin.
-
- (Responses emailed to me as well as posted would be much appreciated)
-
-
-
-